﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace GameName1
{
    class BonusAlien : Alien
    {
        private static Texture2D _commonSprite;
        protected override Texture2D Sprite { get { return _commonSprite; } }
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Sprite, Position, new Color(255,0,0));
        }

        public BonusAlien(Vector2 position, int direction) : base(position)
        {
            Velocity = new Vector2(3*direction,0);
            Points = 200;
        }        

        public override void Update(GameTime gameTime)
        {
            Move();
        }
        public static void LoadContent(ContentManager contentManager)
        {
            _commonSprite = contentManager.Load<Texture2D>("sprites/invader_bonus_v3");
        }

        public override void HandleHit(IHittable other, GameTime colissionTime)
        {          
            if (other is Projectile)
            {
                var position = new Vector2(Position.X, Position.Y + 10);
                var explosion = new BonusAlienExplosion(position, colissionTime);
                GameObjectsManager.GetInstance().Instantiate(explosion);
            }
            base.HandleHit(other, colissionTime);
        }
    }
}
